//
//  ITPingTool.h
//  InduceTool
//
//  Created by 魏延龙 on 2020/8/28.
//  Copyright © 2020 魏延龙. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef enum : NSUInteger {
    // maximumPingTimes 为一个周期， holdNum 为预设不理想
    // 一直loop 达到holdNum抛出结果 继续loop
    PingUseTypeLoop,
    // 只检测一次 达到holdNum 或者达到maximumPingTimes 抛出结果
    PingUseTypeOnce,
} PingUseType;

typedef enum : NSUInteger {
    NetworkStatusGood,
    NetworkStatusBad,
} NetworkStatus;

@interface ITPingTool : NSObject

@property (nonatomic, copy) void(^networkStatusBlock)(NetworkStatus status);

+ (instancetype)serviceWithAddress:(NSString *)address;

+ (instancetype)serviceWithAddress:(NSString *)address maximumPingTimes:(NSInteger)count pingUseType:(PingUseType)pingUseType;

- (void)startPing;

- (void)cancel;

@end

NS_ASSUME_NONNULL_END
